package com.edar.model;

// Generated 2008-10-24 9:29:06 by Hibernate Tools 3.2.1.GA

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
@javax.persistence.Entity
public class Account implements java.io.Serializable {

	private static final long serialVersionUID = -6559592439053087792L;
	
	private Long accountId;
	private String name;
	private String passwd;
	private String email;
	private String mobile;
	private Set<Auth> authes = new HashSet<Auth>(0);
	private Set<Role> roles = new HashSet<Role>(0);

	public Account() {
	}


	public Account(Long accountId) {
		this.accountId = accountId;
	}
	@Column(name="accountid")
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public Long getAccountId() {
		return this.accountId;
	}

	public void setAccountId(Long accountId) {
		this.accountId = accountId;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}


	public String getPasswd() {
		return passwd;
	}


	public void setPasswd(String passwd) {
		this.passwd = passwd;
	}


	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getMobile() {
		return this.mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public void setAuthes(Set<Auth> authes) {
		this.authes = authes;
	}

	public void setRoles(Set<Role> roles) {
		this.roles = roles;
	}
	@ManyToMany(targetEntity=Auth.class,cascade={CascadeType.PERSIST,CascadeType.MERGE})
	@JoinTable(name="account_auth_rela",
			joinColumns=@JoinColumn(name="accountid"),
			inverseJoinColumns=@JoinColumn(name="authid"))
	public Set<Auth> getAuthes() {
		return authes;
	}
	@ManyToMany(targetEntity=Role.class,cascade={CascadeType.PERSIST,CascadeType.MERGE})
	@JoinTable(name="account_role_rela",
			joinColumns=@JoinColumn(name="accountid"),
			inverseJoinColumns=@JoinColumn(name="roleid"))
	public Set<Role> getRoles() {
		return roles;
	}
}
